A switch generally forwards an incoming packet from an input port to another port, such as an output port. For Layer 2 packets, the source and destination medium access control (MAC) addresses are used to determine to which of the output port to forward the packet. Likewise, for Layer 3 packets, the destination internet protocol (IP) address is used to determine to which output port to send the packet.
Tunneling is a technique to deliver a packet from a first point to a second point which may only be possible using the additional tunnel headers or in a more secure protocol provided by the tunneling protocol. Tunneling generally involves encapsulating a complete packet by giving the packet a tunnel packet header that appears before the payload header of the packet. The point where the tunnel header is added is called the tunnel entry point, the tunnel entry point will be identified by the source address of the tunnel header. The destination address of the tunnel header points to the device that is the termination point of the tunnel, which is called the tunnel exit point, where the embedded packet exits the tunnel. The switch which is the tunnel exit point receives the tunneled packet and will, de-capsulate the packet by removing the tunnel header. After decapsulation the payload header of the formerly encapsulated packet is read to determine the forwarding decision of the packet. To give more flexibility for forwarding decisions at the tunnel exit point, a two pass system may be incorporated, where the first pass deals with the tunnel header and the second pass will make forwarding decisions based on the payload packet information. To perform the second pass of forwarding decisions, an efficient way to use existing forwarding hardware is to recirculate the packet from the outbound side back to the inbound side of the switch. This recirculation can be accomplished by using ports that can be called loopback ports. Recirculation can benefit the processing of tunneled packets and potentially other packets that may require a multi-pass forwarding path.